package edu.zhangxu.dao;

import edu.zhangxu.pojo.Problem;

import java.sql.Connection;
import java.util.List;

public class ProblemDaoImp extends BaseDao implements ProblemDao {
    @Override
    public List<Problem> getSimpleAll(Connection con) {
        String sql = "SELECT id,name,difficulty,submit_count submitCount,ac_count acCount FROM problems";
        return getList(con, Problem.class, sql);
    }

    @Override
    public Problem getProblemByName(Connection con, String name) {
        String sql = "SELECT id,name,difficulty,submit_count submitCount,ac_count acCount," +
                     "time_limit timeLimit,memory_limit memoryLimit,description FROM problems WHERE name=?";
        return getInstance(con, Problem.class, sql, name);
    }
}
